package com.example.ali.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.ali.R;
import com.githang.statusbar.StatusBarCompat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class RegisterActivity extends AppCompatActivity {
    @BindView(R.id.set_number)
    EditText setNumber;
    @BindView(R.id.yanzhengma)
    Button yanzhengma;
    @BindView(R.id.set_yanzhengma)
    EditText setYanzhengma;
    @BindView(R.id.set_email)
    EditText setEmail;
    @BindView(R.id.set_password)
    EditText setPassword;
    @BindView(R.id.set_username)
    EditText setUsername;
    @BindView(R.id.set_nickname)
    EditText setNickname;
    @BindView(R.id.go_login)
    ImageView goLogin;
    @BindView(R.id.textView)
    TextView textView;
    @BindView(R.id.Already_number)
    TextView AlreadyNumber;
    @BindView(R.id.imageView2)
    ImageView imageView2;
    @BindView(R.id.register)
    Button register;
    @BindView(R.id.weixin)
    LinearLayout weixin;
    @BindView(R.id.QQ)
    LinearLayout QQ;
    @BindView(R.id.weibo)
    LinearLayout weibo;

    public Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.bind(this);
        StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(this, R.color.colorstatus));

    }


    @OnClick({R.id.go_login, R.id.textView, R.id.Already_number, R.id.imageView2, R.id.register, R.id.weixin, R.id.QQ, R.id.weibo})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.go_login:
                intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                break;
            case R.id.textView:
                break;
            case R.id.Already_number:
                intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                break;
            case R.id.imageView2:
                break;
            case R.id.register:
                if (setNumber.getText().length() != 11 || setPassword.getText().length() <= 5) {

                    if (setNumber.getText().length() != 11) {
                        Toast.makeText(this, "账号不符合规范", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(this, "密码位数不够", Toast.LENGTH_SHORT).show();
                    }
                } else {
                }
                break;
            case R.id.weixin:
                break;
            case R.id.QQ:
                break;
            case R.id.weibo:
                break;
        }
    }
}
